package org.poptest.model;

import org.poptest.util.AssertInternal;

import java.util.ListIterator;

/**
 * @author Alan Roche
 *         Date: 05/02/11
 *         Time: 23:06
 */
public abstract class AbstractNode<SUBCLASS extends AbstractNode> implements Node {
    protected final TestInstance testInstance;


    protected AbstractNode(final TestInstance testInstance) {
        this.testInstance = testInstance;
    }

    protected abstract ListIterator<SUBCLASS> getIteratorAtSelf();

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AbstractNode that = (AbstractNode) o;

        if (testInstance != null ? !testInstance.equals(that.testInstance) : that.testInstance != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return testInstance != null ? testInstance.hashCode() : 0;
    }

}